<html>
<head><meta charset="utf-8"><title>How do I normalize projection types to a single type? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html">How do I normalize projection types to a single type?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212118248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212118248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212118248">(Oct 02 2020 at 19:32)</a>:</h4>
<p>I have a type like <a href="https://docs.rs/safer-ffi/0.0.5/safer_ffi/vec/struct.Vec_Layout.html#structfield.len"><code>&lt;usize as Trait&gt;::Layout</code></a>. How can I turn it into the canonical type <code>usize</code>? I found <code>qpath_res</code> but that seems to apply only to <code>QPath</code>, not to <code>ty::Projection</code>.</p>



<a name="212118731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212118731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212118731">(Oct 02 2020 at 19:36)</a>:</h4>
<p>if you don't care about regions, you can use <code>tcx.normalize_erasing_regions</code></p>



<a name="212118865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212118865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212118865">(Oct 02 2020 at 19:37)</a>:</h4>
<p>So in rustdoc you probably don't want to erase regions, let me quickly find the method which is probably correct here</p>



<a name="212119092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119092">(Oct 02 2020 at 19:39)</a>:</h4>
<p>for context, this is the existing code: <a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/mod.rs#L1514">https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/mod.rs#L1514</a></p>



<a name="212119099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119099">(Oct 02 2020 at 19:39)</a>:</h4>
<p>for rustdoc, probably <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/infer/at/struct.At.html#method.normalize">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/infer/at/struct.At.html#method.normalize</a></p>



<a name="212119112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119112">(Oct 02 2020 at 19:39)</a>:</h4>
<p>which does not normalize the type</p>



<a name="212119205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119205">(Oct 02 2020 at 19:40)</a>:</h4>
<p>where do I get an <code>At</code> from?</p>



<a name="212119251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119251">(Oct 02 2020 at 19:40)</a>:</h4>
<p>infcx.at(span) i think</p>



<a name="212119263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119263">(Oct 02 2020 at 19:40)</a>:</h4>
<p>which can just be <code>DUMMY_SP</code> here</p>



<a name="212119272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119272">(Oct 02 2020 at 19:40)</a>:</h4>
<p>as you shouldn't need it</p>



<a name="212119333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119333">(Oct 02 2020 at 19:41)</a>:</h4>
<p>I expect the resulting Obligations to all be outlives obligations, which you can probably just discard</p>



<a name="212119537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119537">(Oct 02 2020 at 19:43)</a>:</h4>
<p>and then I have another question that I might need to ask <span class="user-mention" data-user-id="210316">@GuillaumeGomez</span> - what do I do with the <code>Normalized</code> type once I have it? Rustdoc expects a <code>rustdoc::Type::QPath</code></p>



<a name="212119952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119952">(Oct 02 2020 at 19:46)</a>:</h4>
<p>can you use the <code>Normalized.value.clean()</code> here? apart from that I can't help you there <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="212119966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119966">(Oct 02 2020 at 19:46)</a>:</h4>
<p><code>at</code> does not take a span: <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxt.html#method.at">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxt.html#method.at</a></p>



<a name="212119991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212119991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212119991">(Oct 02 2020 at 19:47)</a>:</h4>
<p>what are those parameters? I don't recognize these types <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="212120012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120012">(Oct 02 2020 at 19:47)</a>:</h4>
<p><code>ObligationCause</code> can be <code>ObligationCause::dummy()</code></p>



<a name="212120040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120040">(Oct 02 2020 at 19:47)</a>:</h4>
<p>it's mostly used for errors during typeck, so it's not relevant here</p>



<a name="212120175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120175">(Oct 02 2020 at 19:49)</a>:</h4>
<p>so many traits</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">            </span><span class="k">use</span><span class="w"> </span><span class="k">crate</span>::<span class="n">rustc_trait_selection</span>::<span class="n">traits</span>::<span class="n">query</span>::<span class="n">normalize</span>::<span class="n">AtExt</span><span class="p">;</span><span class="w"></span>
<span class="w">            </span><span class="k">use</span><span class="w"> </span><span class="k">crate</span>::<span class="n">rustc_trait_selection</span>::<span class="n">infer</span>::<span class="n">TyCtxtInferExt</span><span class="p">;</span><span class="w"></span>
<span class="w">            </span><span class="k">use</span><span class="w"> </span><span class="n">rustc_middle</span>::<span class="n">traits</span>::<span class="n">ObligationCause</span><span class="p">;</span><span class="w"></span>
</code></pre></div>



<a name="212120207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120207">(Oct 02 2020 at 19:49)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error[E0277]: the trait bound `rustc_hir::Ty&lt;&#39;_&gt;: rustc_middle::ty::TypeFoldable&lt;&#39;_&gt;` is not satisfied
</code></pre></div>


<p>should I pass the HirId instead?</p>



<a name="212120236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120236">(Oct 02 2020 at 19:49)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">ty</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">hir_ty_to_ty</span><span class="p">(</span><span class="n">cx</span><span class="p">.</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="bp">self</span><span class="p">);</span><span class="w"></span>
</code></pre></div>



<a name="212120242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120242">(Oct 02 2020 at 19:50)</a>:</h4>
<p>use that ty</p>



<a name="212120332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120332">(Oct 02 2020 at 19:50)</a>:</h4>
<p>yay making progress <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>
<div class="codehilite"><pre><span></span><code>error[E0308]: mismatched types
    --&gt; src/librustdoc/clean/mod.rs:1482:61
     |
1482 |           hir::QPath::TypeRelative(ref qself, ref segment) =&gt; {
     |  _____________________________________________________________^
1483 | |             use crate::rustc_trait_selection::traits::query::normalize::AtExt;
1484 | |             use crate::rustc_trait_selection::infer::TyCtxtInferExt;
1485 | |             use rustc_middle::traits::ObligationCause;
...    |
1508 | |             */
1509 | |         }
     | |_________^ expected enum `clean::types::Type`, found `()`
</code></pre></div>



<a name="212120475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120475">(Oct 02 2020 at 19:52)</a>:</h4>
<p>for <code>param_env</code>, you probably want <code>tcx.param_env(tcx.hir().hir_id_to_local_def_id(self.hir_id))</code></p>



<a name="212120522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120522">(Oct 02 2020 at 19:52)</a>:</h4>
<p>will that work with function return types too?</p>



<a name="212120540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120540">(Oct 02 2020 at 19:53)</a>:</h4>
<p>I expect it to</p>



<a name="212120747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120747">(Oct 02 2020 at 19:54)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error[E0599]: no method named `hir_id_to_local_def_id` found for struct `rustc_middle::hir::map::Map&lt;&#39;_&gt;` in the current scope
</code></pre></div>


<p>I think this was renamed recently?</p>



<a name="212120792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212120792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212120792">(Oct 02 2020 at 19:55)</a>:</h4>
<p><code>local_def_id</code>, that's it</p>



<a name="212121676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212121676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212121676">(Oct 02 2020 at 20:01)</a>:</h4>
<p>unfortunately this did not work, it looks the same as before:</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs</span>
<span class="gh">index c72fe7b7447..9efe67eb1a9 100644</span>
<span class="gd">--- a/src/librustdoc/clean/mod.rs</span>
<span class="gi">+++ b/src/librustdoc/clean/mod.rs</span>
<span class="gu">@@ -1480,18 +1480,25 @@ fn clean_qpath(hir_ty: &amp;hir::Ty&lt;'_&gt;, cx: &amp;DocContext&lt;'_&gt;) -&gt; Type {</span>
             }
         }
         hir::QPath::TypeRelative(ref qself, ref segment) =&gt; {
<span class="gd">-            let mut res = Res::Err;</span>
<span class="gd">-            /*</span>
<span class="gd">-            let hir_ty = hir::Ty {</span>
<span class="gd">-                kind: hir::TyKind::Path((*qpath).clone()),</span>
<span class="gd">-                hir_id,</span>
<span class="gd">-                span,</span>
<span class="gd">-            };</span>
<span class="gd">-            */</span>
<span class="gi">+            use crate::rustc_trait_selection::traits::query::normalize::AtExt;</span>
<span class="gi">+            use crate::rustc_trait_selection::infer::TyCtxtInferExt;</span>
<span class="gi">+            use rustc_middle::traits::ObligationCause;</span>
<span class="gi">+</span>
             let ty = hir_ty_to_ty(cx.tcx, hir_ty);
<span class="gd">-            if let ty::Projection(proj) = ty.kind() {</span>
<span class="gd">-                res = Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id);</span>
<span class="gd">-            }</span>
<span class="gi">+            let param_env = cx.tcx.param_env(cx.tcx.hir().local_def_id(hir_id));</span>
<span class="gi">+            let normalized = cx.tcx.infer_ctxt().enter(|infcx| {</span>
<span class="gi">+                infcx.at(&amp;ObligationCause::dummy(), param_env).normalize(&amp;ty)</span>
<span class="gi">+            });</span>
<span class="gi">+            match normalized {</span>
<span class="gi">+                Ok(resolved) =&gt; return resolved.value.clean(cx),</span>
<span class="gi">+                Err(_) =&gt; {}</span>
<span class="gi">+            };</span>
<span class="gi">+</span>
<span class="gi">+            let res = if let ty::Projection(proj) = ty.kind() {</span>
<span class="gi">+                Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id)</span>
<span class="gi">+            } else {</span>
<span class="gi">+                Res::Err</span>
<span class="gi">+            };</span>
             let trait_path = hir::Path { span, res, segments: &amp;[] };
             Type::QPath {
                 name: segment.ident.name.clean(cx),
</code></pre></div>



<a name="212121745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212121745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212121745">(Oct 02 2020 at 20:02)</a>:</h4>
<p>let me see if it's actually resolving anything</p>



<a name="212122260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212122260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212122260">(Oct 02 2020 at 20:06)</a>:</h4>
<p>ok yeah it's completely ignoring my changes, presumably because <code>normalize()</code> is returning <code>NoSolution</code></p>



<a name="212122578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212122578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212122578">(Oct 02 2020 at 20:08)</a>:</h4>
<p>... <code>&lt;usize as T&gt;::X</code> is a <code>TypeRelative</code> QPath, right?</p>



<a name="212122636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212122636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212122636">(Oct 02 2020 at 20:09)</a>:</h4>
<p>ahhh no it's a <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.QPath.html#variant.Resolved"><code>QPath::Resolved</code></a></p>



<a name="212122652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212122652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212122652">(Oct 02 2020 at 20:09)</a>:</h4>
<p>well no wonder nothing was happening lol</p>



<a name="212122911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212122911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212122911">(Oct 02 2020 at 20:11)</a>:</h4>
<p>oh boy</p>
<div class="codehilite"><pre><span></span><code>error: internal compiler error: /home/joshua/rustc/compiler/rustc_middle/src/hir/map/mod.rs:163:13: local_def_id: no entry for `HirId { owner: DefId(0:7 ~ assoc_item[8787]::f), local_id: 4 }`, which has a map of `Some(Entry { parent: HirId { owner: DefId(0:7 ~ assoc_item[8787]::f), local_id: 0 }, node: Ty(Ty { hir_id: HirId { owner: DefId(0:7 ~ assoc_item[8787]::f), local_id: 4 }, kind: Path(Resolved(Some(Ty { hir_id: HirId { owner: DefId(0:7 ~ assoc_item[8787]::f), local_id: 5 }, kind: Path(Resolved(None, Path { span: assoc_item.rs:9:16: 9:21 (#0), res: PrimTy(Uint(Usize)), segments: [PathSegment { ident: usize#0, hir_id: Some(HirId { owner: DefId(0:7 ~ assoc_item[8787]::f), local_id: 6 }), res: Some(Err), args: None, infer_args: false }] })), span: assoc_item.rs:9:16: 9:21 (#0) }), Path { span: assoc_item.rs:9:15: 9:30 (#0), res: Def(AssocTy, DefId(0:4 ~ assoc_item[8787]::T::X)), segments: [PathSegment { ident: T#0, hir_id: Some(HirId { owner: DefId(0:7 ~ assoc_item[8787]::f), local_id: 7 }), res: Some(Def(Trait, DefId(0:3 ~ assoc_item[8787]::T))), args: None, infer_args: false }, PathSegment { ident: X#0, hir_id: Some(HirId { owner: DefId(0:7 ~ assoc_item[8787]::f), local_id: 8 }), res: Some(Err), args: None, infer_args: false }] })), span: assoc_item.rs:9:15: 9:30 (#0) }) })`
</code></pre></div>



<a name="212123034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123034">(Oct 02 2020 at 20:12)</a>:</h4>
<p>this is from <code>tcx.hir().local_def_id(hir_id)</code></p>



<a name="212123086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123086">(Oct 02 2020 at 20:13)</a>:</h4>
<p>maybe I should use <code>opt_def_id</code>? When would something not have a DefId to go with it?</p>



<a name="212123096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123096">(Oct 02 2020 at 20:13)</a>:</h4>
<p>but it looks like this is local_def_id for a resolved path? <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="212123485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123485">(Oct 02 2020 at 20:16)</a>:</h4>
<p>this worked:</p>
<div class="codehilite"><pre><span></span><code>    let param_env = if let Some(id) = cx.tcx.hir().opt_local_def_id(hir_id) {
        cx.tcx.param_env(id)
    } else {
        ty::ParamEnv::empty()
    };
</code></pre></div>



<a name="212123510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123510">(Oct 02 2020 at 20:16)</a>:</h4>
<p>wow this was way easier than expected <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> thank you so much for the help! <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="212123782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123782">(Oct 02 2020 at 20:19)</a>:</h4>
<p>uh, that requires review by someone else though, using <code>ParamEnv::empty()</code> causes ICE if the type is generic afaik</p>



<a name="212123805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123805">(Oct 02 2020 at 20:19)</a>:</h4>
<p>indeed it did:</p>
<div class="codehilite"><pre><span></span><code>thread &#39;rustc&#39; panicked at &#39;assertion failed: cx.impl_trait_bounds.borrow().is_empty()&#39;, src/librustdoc/clean/utils.rs:630:5
</code></pre></div>



<a name="212123842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123842">(Oct 02 2020 at 20:19)</a>:</h4>
<p>oh wait that comes from rustdoc</p>



<a name="212123852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123852">(Oct 02 2020 at 20:19)</a>:</h4>
<p>what are param envs again?</p>



<a name="212123924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123924">(Oct 02 2020 at 20:20)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="119009">@eddyb</span> on how to normalize a <code>TyKind::Path(QPath::TypeRelative)</code> for rustdoc</p>



<a name="212123974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123974">(Oct 02 2020 at 20:20)</a>:</h4>
<p>param env contain the predicates of the current environment</p>



<a name="212123986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212123986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212123986">(Oct 02 2020 at 20:20)</a>:</h4>
<p>not typerelative, sorry, I did want it for <code>Resolved</code></p>



<a name="212124005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212124005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212124005">(Oct 02 2020 at 20:21)</a>:</h4>
<p>I got the names mixed up</p>



<a name="212124228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212124228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212124228">(Oct 02 2020 at 20:22)</a>:</h4>
<p>WIP diff: <a href="https://github.com/jyn514/rust/commit/91332e59b6705ff6674d20a7e5307baa9b6cedec">https://github.com/jyn514/rust/commit/91332e59b6705ff6674d20a7e5307baa9b6cedec</a></p>



<a name="212124272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212124272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212124272">(Oct 02 2020 at 20:23)</a>:</h4>
<p>i think you should use <code>p.res.def_id()</code> here</p>



<a name="212124287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212124287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212124287">(Oct 02 2020 at 20:23)</a>:</h4>
<p>for the param_env</p>



<a name="212124355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212124355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212124355">(Oct 02 2020 at 20:24)</a>:</h4>
<p>what's p, sorry? the path?</p>



<a name="212124505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212124505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212124505">(Oct 02 2020 at 20:25)</a>:</h4>
<blockquote>
<p>for context, this is the existing code: <a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/mod.rs#L1514">https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/mod.rs#L1514</a></p>
</blockquote>
<p>I thought you were looking at this? <span aria-label="shock" class="emoji emoji-1f628" role="img" title="shock">:shock:</span></p>



<a name="212124518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212124518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212124518">(Oct 02 2020 at 20:25)</a>:</h4>
<p>maybe I only want this for <code>QPath::Resolved(Some(qself), path)</code>, since <code>Clone::clone</code> already looks fine and not ugly</p>



<a name="212124551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212124551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212124551">(Oct 02 2020 at 20:25)</a>:</h4>
<p>yeah I'm looking there I'm just not familiar with the code - I was looking before the match instead of in the middle</p>



<a name="212124747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212124747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212124747">(Oct 02 2020 at 20:27)</a>:</h4>
<p>aghhh I ran <code>cargo fmt</code> isntead of <code>x.py fmt</code> by mistake and it's rebuilding the whole compiler <span aria-label="cry" class="emoji emoji-1f622" role="img" title="cry">:cry:</span></p>



<a name="212125188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212125188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212125188">(Oct 02 2020 at 20:31)</a>:</h4>
<p>ok changing this to only run for <code>Resolved</code> with <code>path.res.def_id()</code> is working on my test case :) let me see if any ICEs pop up</p>



<a name="212125287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212125287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212125287">(Oct 02 2020 at 20:32)</a>:</h4>
<p>nope it all works <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span> <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="212125298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212125298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212125298">(Oct 02 2020 at 20:32)</a>:</h4>
<p>thank you so much <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="212125345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212125345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212125345">(Oct 02 2020 at 20:33)</a>:</h4>
<p><span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span> glad to help, still get someone other than me to review these changes though</p>



<a name="212125400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212125400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212125400">(Oct 02 2020 at 20:33)</a>:</h4>
<p>who would you recommend? eddyb?</p>



<a name="212125407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212125407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212125407">(Oct 02 2020 at 20:33)</a>:</h4>
<p>I am not sure if that's the easiest way, or even a good one, to do this</p>



<a name="212125431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212125431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212125431">(Oct 02 2020 at 20:33)</a>:</h4>
<p>well it's <em>a</em> way which is more than rustdoc had before <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="212125532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212125532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212125532">(Oct 02 2020 at 20:34)</a>:</h4>
<p>yeah, it would probably be good for <span class="user-mention silent" data-user-id="119009">eddyb</span> to look over this</p>



<a name="212125634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212125634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212125634">(Oct 02 2020 at 20:35)</a>:</h4>
<p>still ping me on the PR though <span aria-label="sparkles" class="emoji emoji-2728" role="img" title="sparkles">:sparkles:</span></p>



<a name="212126044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212126044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212126044">(Oct 02 2020 at 20:38)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/77467">https://github.com/rust-lang/rust/pull/77467</a></p>



<a name="212126659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212126659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212126659">(Oct 02 2020 at 20:44)</a>:</h4>
<p>running a build of the compiler docs now</p>



<a name="212126777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212126777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212126777">(Oct 02 2020 at 20:45)</a>:</h4>
<p>looks good to me at least</p>



<a name="212128630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212128630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212128630">(Oct 02 2020 at 21:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/212125298">said</a>:</p>
<blockquote>
<p>thank you so much <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>
</blockquote>
<p>I take it all back, there is no reason to thank me... thank you for fixing the query return types</p>



<a name="212128646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212128646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212128646">(Oct 02 2020 at 21:02)</a>:</h4>
<p>i am deeply in love</p>



<a name="212128656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212128656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212128656">(Oct 02 2020 at 21:03)</a>:</h4>
<p>they were bothering me so much lol</p>



<a name="212128668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212128668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212128668">(Oct 02 2020 at 21:03)</a>:</h4>
<p>literally impossible to read</p>



<a name="212129049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212129049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212129049">(Oct 02 2020 at 21:06)</a>:</h4>
<p>yes, awesome!! :D</p>



<a name="212129056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212129056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212129056">(Oct 02 2020 at 21:06)</a>:</h4>
<p>That is sooo much better!!! <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="212131304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212131304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212131304">(Oct 02 2020 at 21:31)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> can you check if <a href="https://github.com/rust-lang/rust/issues/14072">https://github.com/rust-lang/rust/issues/14072</a> is fixed or related? it seems similar at a high level</p>



<a name="212131416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212131416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212131416">(Oct 02 2020 at 21:32)</a>:</h4>
<p>wow, that's an <em>old</em> link at the top of that issue</p>



<a name="212131430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212131430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212131430">(Oct 02 2020 at 21:32)</a>:</h4>
<p>looks like <a href="https://doc.rust-lang.org/std/str/struct.CharIndices.html">https://doc.rust-lang.org/std/str/struct.CharIndices.html</a> is the modern version</p>



<a name="212131573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212131573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212131573">(Oct 02 2020 at 21:34)</a>:</h4>
<p>I don't see any examples that are still broken? <a href="https://doc.rust-lang.org/nightly/std/str/struct.Lines.html#impl-Iterator">https://doc.rust-lang.org/nightly/std/str/struct.Lines.html#impl-Iterator</a> shows <code>&amp;'a str</code>, not <code>Self::Item</code></p>



<a name="212131666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212131666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212131666">(Oct 02 2020 at 21:34)</a>:</h4>
<p>if you mean <a href="https://github.com/rust-lang/rust/issues/15977#issuecomment-71316427">https://github.com/rust-lang/rust/issues/15977#issuecomment-71316427</a> this won't help at all with that, it's not related to normalization</p>



<a name="212131810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212131810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212131810">(Oct 02 2020 at 21:36)</a>:</h4>
<p>yeah none of those are qualified paths, so my fix won't affect them</p>



<a name="212132021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212132021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212132021">(Oct 02 2020 at 21:38)</a>:</h4>
<p>This one shows the <code>&lt;A&gt;</code> that Alex mentioned:<br>
<a href="https://doc.rust-lang.org/0.10/std/str/struct.CharOffsets.html">https://doc.rust-lang.org/0.10/std/str/struct.CharOffsets.html</a></p>



<a name="212132040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212132040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212132040">(Oct 02 2020 at 21:38)</a>:</h4>
<p>but it already looks better here: <br>
<a href="https://doc.rust-lang.org/0.11.0/std/str/struct.CharOffsets.html">https://doc.rust-lang.org/0.11.0/std/str/struct.CharOffsets.html</a></p>



<a name="212132074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212132074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212132074">(Oct 02 2020 at 21:39)</a>:</h4>
<p>both are back before associated types</p>



<a name="212133600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212133600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212133600">(Oct 02 2020 at 21:57)</a>:</h4>
<p>fyi if someone else wants to review <a href="https://github.com/rust-lang/rust/pull/77467">https://github.com/rust-lang/rust/pull/77467</a> feel free, I just pinged eddyb since <span class="user-mention silent" data-user-id="216206">lcnr</span> suggested it</p>



<a name="212134183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212134183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212134183">(Oct 02 2020 at 22:04)</a>:</h4>
<p>Should I mark it as <code>relnotes</code>? :)</p>



<a name="212158912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212158912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212158912">(Oct 03 2020 at 07:43)</a>:</h4>
<p>yeah, I think this change would make sense as relnotes</p>



<a name="212158921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212158921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212158921">(Oct 03 2020 at 07:43)</a>:</h4>
<p>done</p>



<a name="212948687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212948687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212948687">(Oct 11 2020 at 04:43)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> so, I got stuck trying to make this work across crates</p>



<a name="212948689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212948689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212948689">(Oct 11 2020 at 04:43)</a>:</h4>
<p>I tried implementing it for <code>ty::ProjectionTy</code> and it didn't work at all</p>



<a name="212948731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212948731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212948731">(Oct 11 2020 at 04:44)</a>:</h4>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gu">@@ -570,9 +570,34 @@ impl&lt;'tcx&gt; Clean&lt;Type&gt; for ty::ProjectionTy&lt;'tcx&gt; {</span>
             GenericBound::TraitBound(t, _) =&gt; t.trait_,
             GenericBound::Outlives(_) =&gt; panic!("cleaning a trait got a lifetime"),
         };
<span class="gi">+        use crate::rustc_trait_selection::infer::TyCtxtInferExt;</span>
<span class="gi">+        use crate::rustc_trait_selection::traits::query::normalize::AtExt;</span>
<span class="gi">+        use rustc_middle::traits::ObligationCause;</span>
<span class="gi">+</span>
<span class="gi">+        // Try to normalize `&lt;X as Y&gt;::T` to a type</span>
<span class="gi">+        // FIXME: this param_env looks wrong</span>
<span class="gi">+        //let trait_ref = cx.tcx.associated_item(self.item_def_id).container.id();</span>
<span class="gi">+        let param_env = cx.tcx.param_env(self.item_def_id);</span>
<span class="gi">+        let normalized = cx.tcx.infer_ctxt().enter(|infcx| {</span>
<span class="gi">+            infcx</span>
<span class="gi">+                .at(&amp;ObligationCause::dummy(), param_env)</span>
<span class="gi">+                .normalize(&amp;lifted)</span>
<span class="gi">+                .map(|resolved| infcx.resolve_vars_if_possible(&amp;resolved.value))</span>
<span class="gi">+        });</span>
<span class="gi">+        let ty = match &amp;normalized {</span>
<span class="gi">+            Ok(normalized_value) =&gt; {</span>
<span class="gi">+                debug!("resolved {:?} to {:?}", self, normalized_value);</span>
<span class="gi">+                &amp;normalized_value</span>
<span class="gi">+            }</span>
<span class="gi">+            Err(err) =&gt; {</span>
<span class="gi">+                debug!("failed to resolve {:?}: {:?}", self, err);</span>
<span class="gi">+                self</span>
<span class="gi">+            }</span>
<span class="gi">+        };</span>
<span class="gi">+</span>
         Type::QPath {
<span class="gd">-            name: cx.tcx.associated_item(self.item_def_id).ident.name.clean(cx),</span>
<span class="gd">-            self_type: box self.self_ty().clean(cx),</span>
<span class="gi">+            name: cx.tcx.associated_item(ty.item_def_id).ident.name.clean(cx),</span>
<span class="gi">+            self_type: box ty.self_ty().clean(cx),</span>
             trait_: box trait_,
         }
     }
</code></pre></div>

<p>gives</p>
<div class="codehilite"><pre><span></span><code>DEBUG rustdoc::clean resolved ProjectionTy { substs: [u32], item_def_id: DefId(18:4 ~ inner[8787]::MyTrait::Y) } to ProjectionTy { substs: [u32], item_def_id: DefId(18:4 ~ inner[8787]::MyTrait::Y) }
</code></pre></div>


<p>which is not at all helpful</p>



<a name="212948733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212948733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212948733">(Oct 11 2020 at 04:44)</a>:</h4>
<p>for</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// crate1</span>
<span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">MyTrait</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Y</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">MyTrait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="kt">u32</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kt">i32</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="o">&lt;</span><span class="kt">u32</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">MyTrait</span><span class="o">&gt;</span>::<span class="n">Y</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="mi">0</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="c1">// crate2</span>
<span class="k">pub</span><span class="w"> </span><span class="k">use</span><span class="w"> </span><span class="n">crate1</span>::<span class="n">foo</span><span class="p">;</span><span class="w"></span>
</code></pre></div>



<a name="212948739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212948739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212948739">(Oct 11 2020 at 04:45)</a>:</h4>
<p>and using <code>normalize(lifted.self_ty())</code> instead of <code>normalize(lifted)</code> gives back <code>u32</code> which isn't at all helpful</p>



<a name="212948783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212948783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212948783">(Oct 11 2020 at 04:46)</a>:</h4>
<p>maybe I need <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.subst_and_normalize_erasing_regions"><code>subst_and_normalize_erasing_regions</code></a>?</p>



<a name="212955171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212955171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212955171">(Oct 11 2020 at 08:22)</a>:</h4>
<p>will look at this tomorrow, don't have to time rn. Ping me next evening if I don't reply by then</p>



<a name="212963057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212963057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212963057">(Oct 11 2020 at 12:09)</a>:</h4>
<p>What time is evening? <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="212963738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/212963738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#212963738">(Oct 11 2020 at 12:30)</a>:</h4>
<p>26 hours from now <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="213037191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213037191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213037191">(Oct 12 2020 at 13:23)</a>:</h4>
<p>can you push this to github and link it to me?</p>



<a name="213038269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038269">(Oct 12 2020 at 13:32)</a>:</h4>
<p>yes, one sec</p>



<a name="213038335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038335">(Oct 12 2020 at 13:32)</a>:</h4>
<p>wait, are you normalizing the <code>ProjectionTy</code> instead of the <code>Ty</code> itself?</p>



<a name="213038371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038371">(Oct 12 2020 at 13:32)</a>:</h4>
<p>... yes, is that wrong?</p>



<a name="213038435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038435">(Oct 12 2020 at 13:33)</a>:</h4>
<p>yeah, normalization uses <code>fold_ty</code> to normalize projections</p>



<a name="213038486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038486">(Oct 12 2020 at 13:33)</a>:</h4>
<p>so you have to fold the whole type for this to work</p>



<a name="213038579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038579">(Oct 12 2020 at 13:34)</a>:</h4>
<p>ok I see, <code>ProjectionTy</code> is always part of a larger <code>Ty</code></p>



<a name="213038594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038594">(Oct 12 2020 at 13:34)</a>:</h4>
<p>why does it implement <code>TypeFoldable</code>?</p>



<a name="213038678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038678">(Oct 12 2020 at 13:35)</a>:</h4>
<p>because <code>Ty</code> recursively calls <code>ty::Projection(proj) =&gt; proj.fold_with(folder)</code></p>



<a name="213038724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038724">(Oct 12 2020 at 13:35)</a>:</h4>
<p>it might be less hazardous to instead manually call <code>fold_with</code> for all fields in <code>Ty::super_fold_with</code></p>



<a name="213038823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038823">(Oct 12 2020 at 13:36)</a>:</h4>
<p>but tbh, it is quite nice to be able to just derive <code>TypeFoldable</code> for everything and do it like this</p>



<a name="213038877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038877">(Oct 12 2020 at 13:36)</a>:</h4>
<p>I do not see <code>impl Clean&lt;Type&gt; for ty::Ty</code> in rustdoc</p>



<a name="213038930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038930">(Oct 12 2020 at 13:37)</a>:</h4>
<p>Maybe <code>TyS</code></p>



<a name="213038944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038944">(Oct 12 2020 at 13:37)</a>:</h4>
<p>nothing starting with <code>Ty</code> :(</p>



<a name="213038987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038987">(Oct 12 2020 at 13:37)</a>:</h4>
<p>src/librustdoc/clean/mod.rs:1557</p>



<a name="213038990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213038990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213038990">(Oct 12 2020 at 13:37)</a>:</h4>
<p>oh wait I found it, it didn't have the <code>ty::</code> prefix</p>



<a name="213039093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039093">(Oct 12 2020 at 13:38)</a>:</h4>
<p>ok nice,  so I can just normalize it before the giant match?</p>



<a name="213039142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039142">(Oct 12 2020 at 13:39)</a>:</h4>
<p>probably, I am not sure if you sometimes want to keep things unnormalized</p>



<a name="213039203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039203">(Oct 12 2020 at 13:39)</a>:</h4>
<p>if not you should be able to just normalize once at the start</p>



<a name="213039355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039355">(Oct 12 2020 at 13:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/213039142">said</a>:</p>
<blockquote>
<p>probably, I am not sure if you sometimes want to keep things unnormalized</p>
</blockquote>
<p>I don't plan to, actually I would like to normalize even <em>more</em> and 'partially' normalize things if possible</p>



<a name="213039401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039401">(Oct 12 2020 at 13:40)</a>:</h4>
<p>what does 'partially' normalize mean here?</p>



<a name="213039422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039422">(Oct 12 2020 at 13:41)</a>:</h4>
<p>like turning <code>&lt;Vec&lt;T&gt; as IntoIterator&gt;::IntoIter</code> into <code>vec::IntoIter&lt;T&gt;</code></p>



<a name="213039443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039443">(Oct 12 2020 at 13:41)</a>:</h4>
<p>where you don't know what <code>T</code> is but the type can still be simplified</p>



<a name="213039462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039462">(Oct 12 2020 at 13:41)</a>:</h4>
<p>doesn't this already happen with <code>fn normalize</code>?</p>



<a name="213039477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039477">(Oct 12 2020 at 13:41)</a>:</h4>
<p>let me try that <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="213039494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213039494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213039494">(Oct 12 2020 at 13:41)</a>:</h4>
<p>maybe it didn't work before because it was on the HIR</p>



<a name="213043053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043053">(Oct 12 2020 at 14:10)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> how would I get the <code>param_env</code> for a <code>Ty</code>? I tried <code>tcx.param_env(ty)</code> and it said that doesn't work:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">error</span><span class="p">[</span><span class="n">E0277</span><span class="p">]</span>: <span class="nc">the</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">bound</span><span class="w"> </span><span class="err">`</span><span class="o">&amp;</span><span class="n">TyS</span><span class="o">&lt;'</span><span class="nb">_</span><span class="o">&gt;</span>: <span class="nc">rustc_middle</span>::<span class="n">ty</span>::<span class="n">query</span>::<span class="n">sealed</span>::<span class="n">IntoQueryParam</span><span class="o">&lt;</span><span class="n">rustc_span</span>::<span class="n">def_id</span>::<span class="n">DefId</span><span class="o">&gt;</span><span class="err">`</span><span class="w"> </span><span class="n">is</span><span class="w"> </span><span class="n">not</span><span class="w"> </span><span class="n">satisfied</span><span class="w"></span>
<span class="w">    </span><span class="o">-</span>-&gt; <span class="nc">src</span><span class="o">/</span><span class="n">librustdoc</span><span class="o">/</span><span class="n">clean</span><span class="o">/</span><span class="k">mod</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">1594</span>:<span class="mi">42</span><span class="w"></span>
<span class="w">     </span><span class="o">|</span><span class="w"></span>
<span class="mi">1594</span><span class="w"> </span><span class="o">|</span><span class="w">         </span><span class="kd">let</span><span class="w"> </span><span class="n">param_env</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">cx</span><span class="p">.</span><span class="n">tcx</span><span class="p">.</span><span class="n">param_env</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="p">);</span><span class="w"></span>
<span class="w">     </span><span class="o">|</span><span class="w">                                          </span><span class="o">^^^^^</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="err">`</span><span class="n">rustc_middle</span>::<span class="n">ty</span>::<span class="n">query</span>::<span class="n">sealed</span>::<span class="n">IntoQueryParam</span><span class="o">&lt;</span><span class="n">rustc_span</span>::<span class="n">def_id</span>::<span class="n">DefId</span><span class="o">&gt;</span><span class="err">`</span><span class="w"> </span><span class="n">is</span><span class="w"> </span><span class="n">not</span><span class="w"> </span><span class="n">implemented</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="err">`</span><span class="o">&amp;</span><span class="n">TyS</span><span class="o">&lt;'</span><span class="nb">_</span><span class="o">&gt;</span><span class="err">`</span><span class="w"></span>
</code></pre></div>



<a name="213043138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043138">(Oct 12 2020 at 14:11)</a>:</h4>
<p>that's hard</p>



<a name="213043168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043168">(Oct 12 2020 at 14:11)</a>:</h4>
<p>I think you either have to remember the param_env of the current context</p>



<a name="213043195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043195">(Oct 12 2020 at 14:11)</a>:</h4>
<p><em>you can have the same <code>ty::Ty</code> in different <code>param_env</code>s</em></p>



<a name="213043257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043257">(Oct 12 2020 at 14:12)</a>:</h4>
<p>well this is unfortunate</p>



<a name="213043272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043272">(Oct 12 2020 at 14:12)</a>:</h4>
<p>rustdoc currently doesn't track that at <em>all</em></p>



<a name="213043633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043633">(Oct 12 2020 at 14:15)</a>:</h4>
<p>(it would in general be better to do so I think)</p>



<a name="213043685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043685">(Oct 12 2020 at 14:15)</a>:</h4>
<p>let me try and think of a quick hack in until then</p>



<a name="213043831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043831">(Oct 12 2020 at 14:16)</a>:</h4>
<p>I don't mind doing the larger change if you tell me how</p>



<a name="213043878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043878">(Oct 12 2020 at 14:17)</a>:</h4>
<p>you could get away with only normalizing concrete types for now which should work with an empty param env until <code>trivial_bounds</code> are stable</p>



<a name="213043896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043896">(Oct 12 2020 at 14:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/213043831">said</a>:</p>
<blockquote>
<p>I don't mind doing the larger change if you tell me how</p>
</blockquote>
<p>....</p>



<a name="213043903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213043903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213043903">(Oct 12 2020 at 14:17)</a>:</h4>
<p>let me see</p>



<a name="213044049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213044049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213044049">(Oct 12 2020 at 14:18)</a>:</h4>
<blockquote>
<p>only normalizing concrete bounds</p>
</blockquote>
<p>I think we found why my IntoIter example didn't work <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="213044147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213044147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213044147">(Oct 12 2020 at 14:19)</a>:</h4>
<p>what are you citing here?</p>



<a name="213044702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213044702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213044702">(Oct 12 2020 at 14:24)</a>:</h4>
<p>I guess my idea would be to add a <code>current_context: Cell&lt;Option&lt;DefId&gt;&gt;</code> to <code>DocContext</code> which you always update to be the current context you are in</p>



<a name="213044983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213044983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213044983">(Oct 12 2020 at 14:26)</a>:</h4>
<p>probably by adding a method like </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="w"> </span><span class="n">DocContext</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">with_context</span><span class="o">&lt;</span><span class="n">F</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">context</span>: <span class="nb">Option</span><span class="o">&lt;</span><span class="n">DefId</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">f</span>: <span class="nc">F</span><span class="p">)</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="n">F</span>: <span class="nb">FnOnce</span><span class="p">(</span><span class="o">&amp;</span><span class="n">DocContext</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">T</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">old</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">context</span><span class="p">.</span><span class="n">get</span><span class="p">();</span><span class="w"></span>
<span class="w">        </span><span class="bp">self</span><span class="p">.</span><span class="n">context</span><span class="p">.</span><span class="n">set</span><span class="p">(</span><span class="n">context</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">v</span><span class="w"> </span><span class="o">=</span><span class="w">  </span><span class="n">f</span><span class="p">(</span><span class="bp">self</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="bp">self</span><span class="p">.</span><span class="n">context</span><span class="p">.</span><span class="n">set</span><span class="p">(</span><span class="n">old</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="n">v</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213045141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213045141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213045141">(Oct 12 2020 at 14:28)</a>:</h4>
<p>though I would want the opinion of someone else here before start implementing this</p>



<a name="213048036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213048036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213048036">(Oct 12 2020 at 14:49)</a>:</h4>
<p>Instead of having rustdoc (and by extension, every external tool) track this itself, could we have rustc do it? Allow recursively normalizing everything in a module?</p>



<a name="213048299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213048299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213048299">(Oct 12 2020 at 14:51)</a>:</h4>
<p>It seems a shame to duplicate tricky logic like this everywhere</p>



<a name="213048444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/213048444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#213048444">(Oct 12 2020 at 14:52)</a>:</h4>
<p>(tricky -&gt; easy to get wrong, not hard)</p>



<a name="217589713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/217589713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#217589713">(Nov 23 2020 at 05:02)</a>:</h4>
<p>I <em>finally</em> got this working :) <a href="https://github.com/rust-lang/rust/pull/77467#issuecomment-731922562">https://github.com/rust-lang/rust/pull/77467#issuecomment-731922562</a></p>



<a name="217589823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/217589823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#217589823">(Nov 23 2020 at 05:04)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> <span class="user-mention" data-user-id="119009">@eddyb</span>  thanks so much for all the help :)</p>



<a name="218125195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125195">(Nov 27 2020 at 20:00)</a>:</h4>
<p><span class="user-mention" data-user-id="125294">@Aaron Hill</span> so your idea didn't work unfortunately :( <a href="https://github.com/rust-lang/rust/issues/79459#issuecomment-734967453">https://github.com/rust-lang/rust/issues/79459#issuecomment-734967453</a></p>



<a name="218125218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125218">(Nov 27 2020 at 20:01)</a>:</h4>
<p>currently I'm trying "just don't report an error" but I doubt that will go very well</p>



<a name="218125223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125223">(Nov 27 2020 at 20:01)</a>:</h4>
<p>Hmm</p>



<a name="218125228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125228">(Nov 27 2020 at 20:01)</a>:</h4>
<p>I'll have to take a look</p>



<a name="218125286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125286">(Nov 27 2020 at 20:02)</a>:</h4>
<p>this does fix the issue FWIW:</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs</span>
<span class="gh">index a04f816b0f8..8087e9070c4 100644</span>
<span class="gd">--- a/compiler/rustc_trait_selection/src/traits/fulfill.rs</span>
<span class="gi">+++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs</span>
<span class="gu">@@ -21,7 +21,7 @@</span>
 use super::{FulfillmentError, FulfillmentErrorCode};
 use super::{ObligationCause, PredicateObligation};

<span class="gd">-use crate::traits::error_reporting::InferCtxtExt as _;</span>
<span class="gi">+//use crate::traits::error_reporting::InferCtxtExt as _;</span>
 use crate::traits::project::PolyProjectionObligation;
 use crate::traits::query::evaluate_obligation::InferCtxtExt as _;

<span class="gu">@@ -317,8 +317,8 @@ fn process_backedge&lt;'c, I&gt;(</span>
         if self.selcx.coinductive_match(cycle.clone().map(|s| s.obligation.predicate)) {
             debug!("process_child_obligations: coinductive match");
         } else {
<span class="gd">-            let cycle: Vec&lt;_&gt; = cycle.map(|c| c.obligation.clone()).collect();</span>
<span class="gd">-            self.selcx.infcx().report_overflow_error_cycle(&amp;cycle);</span>
<span class="gi">+            //let cycle: Vec&lt;_&gt; = cycle.map(|c| c.obligation.clone()).collect();</span>
<span class="gi">+            //self.selcx.infcx().report_overflow_error_cycle(&amp;cycle);</span>
         }
     }
 }
</code></pre></div>



<a name="218125291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125291">(Nov 27 2020 at 20:02)</a>:</h4>
<p>but doesn't make sense in general</p>



<a name="218125293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125293">(Nov 27 2020 at 20:02)</a>:</h4>
<p>Can you try running it with <code>RUSTDOCFLAGS="-Z treat-err-as-bug=1"</code>, with that change applied</p>



<a name="218125299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125299">(Nov 27 2020 at 20:02)</a>:</h4>
<p>the <code>TraitQueryMode</code> change</p>



<a name="218125301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125301">(Nov 27 2020 at 20:02)</a>:</h4>
<p>sure</p>



<a name="218125306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125306">(Nov 27 2020 at 20:02)</a>:</h4>
<p>and see where the error is getting reported from?</p>



<a name="218125317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125317">(Nov 27 2020 at 20:03)</a>:</h4>
<p>this is where it was before, would you expect it to change with the TraitQueryMode change? <a href="https://github.com/rust-lang/rust/issues/79459#issuecomment-734863569">https://github.com/rust-lang/rust/issues/79459#issuecomment-734863569</a></p>



<a name="218125354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125354">(Nov 27 2020 at 20:03)</a>:</h4>
<p>yeah</p>



<a name="218125362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125362">(Nov 27 2020 at 20:03)</a>:</h4>
<p>if it doesn't change, it'll be good to see what the call stack looks like</p>



<a name="218125523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125523">(Nov 27 2020 at 20:05)</a>:</h4>
<p><a href="https://hastebin.com/momedozire.rust">https://hastebin.com/momedozire.rust</a></p>



<a name="218125727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125727">(Nov 27 2020 at 20:08)</a>:</h4>
<p>it's exactly the same as the normal backtrace :/</p>



<a name="218125810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218125810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218125810">(Nov 27 2020 at 20:09)</a>:</h4>
<blockquote>
<p>The normalize_projection_ty query calls <code>SelectionContext::new</code></p>
</blockquote>
<p>I'm not sure that closure is ever being called - if you look in the backtrace, there's a call to <code>enter_canonical_trait_query</code>, but not to <code>normalize_projection_ty::{{closure}}</code></p>



<a name="218126209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126209">(Nov 27 2020 at 20:15)</a>:</h4>
<p>isn't this actually unrelated to projections?</p>



<a name="218126219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126219">(Nov 27 2020 at 20:15)</a>:</h4>
<p>but instead an issue when dealing with type aliases</p>



<a name="218126222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126222">(Nov 27 2020 at 20:15)</a>:</h4>
<p>Oh, it looks like it's actually coming from <code>FulfillemtnContext</code></p>



<a name="218126228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126228">(Nov 27 2020 at 20:15)</a>:</h4>
<p>as they aren't well formed</p>



<a name="218126248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126248">(Nov 27 2020 at 20:15)</a>:</h4>
<p>we probably fail here while trying to prove <code>Source: SelectDsl</code></p>



<a name="218126249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126249">(Nov 27 2020 at 20:15)</a>:</h4>
<p>I think the root cause is that we try to normalize a projection that the user didn't ask us to normalize</p>



<a name="218126301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126301">(Nov 27 2020 at 20:16)</a>:</h4>
<p>so we don't want to report any errors that occur</p>



<a name="218126304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126304">(Nov 27 2020 at 20:16)</a>:</h4>
<p>including overflow errors</p>



<a name="218126336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126336">(Nov 27 2020 at 20:16)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218126209">said</a>:</p>
<blockquote>
<p>isn't this actually unrelated to projections?</p>
</blockquote>
<p>or well, it is related <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> but not in the way one might expect</p>



<a name="218126455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126455">(Nov 27 2020 at 20:18)</a>:</h4>
<p>if it helps, removing the <code>SelectDsl</code> bound <code>T::Query</code> has no effect on the error</p>



<a name="218126496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126496">(Nov 27 2020 at 20:19)</a>:</h4>
<p>but removing either blanket impl does fix it</p>



<a name="218126533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126533">(Nov 27 2020 at 20:20)</a>:</h4>
<p>and <code>no_core</code> has no effect either (not that I expected it to, but it means I can test without having to recompile libstd)</p>



<a name="218126748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126748">(Nov 27 2020 at 20:23)</a>:</h4>
<p>ok, here's a smaller reproduction:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// check-pass</span>
<span class="cp">#![feature(no_core)]</span><span class="w"></span>
<span class="cp">#![no_core]</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">AsQuery</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Query</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="n">AsQuery</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Query</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">SelectDsl</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="n">SelectDsl</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">T</span>: <span class="nc">AsQuery</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="c1">//T::Query: SelectDsl,</span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="n">T</span>::<span class="n">Query</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">SelectDsl</span><span class="o">&gt;</span>::<span class="n">Output</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">type</span> <span class="nc">Select</span><span class="o">&lt;</span><span class="n">Source</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Source</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">SelectDsl</span><span class="o">&gt;</span>::<span class="n">Output</span><span class="p">;</span><span class="w"></span>
</code></pre></div>



<a name="218126811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126811">(Nov 27 2020 at 20:24)</a>:</h4>
<p>in particular, note that <code>&lt;Source as SelectDsl&gt;::Output</code> is itself <code>&lt;Source as SelectDsl&gt;::Output</code>, since <code>Source::Query</code> is itself <code>Source</code></p>



<a name="218126845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126845">(Nov 27 2020 at 20:25)</a>:</h4>
<p>and if you change the blanket impl to <code>type Query = usize</code>, the error changes:<br>
<code>error[E0275]: overflow evaluating the requirement `&lt;usize as SelectDsl&gt;::Output == _` </code></p>



<a name="218126908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126908">(Nov 27 2020 at 20:26)</a>:</h4>
<p>(can we add a flag to <code>TyCtxt</code> on whether it's building rustdoc and use that here)</p>



<a name="218126918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126918">(Nov 27 2020 at 20:26)</a>:</h4>
<p>well, rustdoc doesn't <em>always</em> want it I think</p>



<a name="218126929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126929">(Nov 27 2020 at 20:26)</a>:</h4>
<p>... actually, are there any other times when it normalizes a type?</p>



<a name="218126938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126938">(Nov 27 2020 at 20:27)</a>:</h4>
<p>maybe we could just slap <code>if !sess.actually_rustdoc</code> on it again <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="218126948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126948">(Nov 27 2020 at 20:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218126929">said</a>:</p>
<blockquote>
<p>... actually, are there any other times when it normalizes a type?</p>
</blockquote>
<p>auto trait checking</p>



<a name="218126949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126949">(Nov 27 2020 at 20:27)</a>:</h4>
<p>probably</p>



<a name="218126954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218126954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218126954">(Nov 27 2020 at 20:27)</a>:</h4>
<p>but not dying on overflow errors also seems fine to me here</p>



<a name="218127007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127007">(Nov 27 2020 at 20:28)</a>:</h4>
<p>oh interesting, my smaller reproduction also gives an error with rustc <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=7d790865295345b9108dc628a2ad97d9">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=7d790865295345b9108dc628a2ad97d9</a></p>



<a name="218127020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127020">(Nov 27 2020 at 20:28)</a>:</h4>
<p>the first example has a <code>T: Query</code> bound</p>



<a name="218127022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127022">(Nov 27 2020 at 20:28)</a>:</h4>
<p>but not if I uncomment <code>T::Query: SelectDsl</code></p>



<a name="218127046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127046">(Nov 27 2020 at 20:29)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=7c51af7f2917678afaec20bee3745e21">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=7c51af7f2917678afaec20bee3745e21</a></p>



<a name="218127062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127062">(Nov 27 2020 at 20:29)</a>:</h4>
<p>right, yes, I got rid of that locally since it wasn't needed</p>



<a name="218127139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127139">(Nov 27 2020 at 20:30)</a>:</h4>
<p>why would that be different between rustc and rustdoc?</p>



<a name="218127186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127186">(Nov 27 2020 at 20:31)</a>:</h4>
<p>ah ok it shows up in both if you use it in a type: <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=94f1c00cfd195ca1addcee2f30ad71ec">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=94f1c00cfd195ca1addcee2f30ad71ec</a></p>



<a name="218127273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127273">(Nov 27 2020 at 20:32)</a>:</h4>
<p>(i am kind of surprised that rustc tries to normalize <code>Select</code> at all if it isn't used)</p>



<a name="218127324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127324">(Nov 27 2020 at 20:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218126938">said</a>:</p>
<blockquote>
<p>maybe we could just slap <code>if !sess.actually_rustdoc</code> on it again <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>
</blockquote>
<p>i would like that</p>



<a name="218127327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127327">(Nov 27 2020 at 20:33)</a>:</h4>
<p>ok, I'll try it <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="218127377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127377">(Nov 27 2020 at 20:34)</a>:</h4>
<p>is there really nothing else in the compiler that tries to normalize things and recover from errors?</p>



<a name="218127379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127379">(Nov 27 2020 at 20:34)</a>:</h4>
<p>i think it's fine for rustdoc to incorrectly believe something is implemented</p>



<a name="218127391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127391">(Nov 27 2020 at 20:34)</a>:</h4>
<p>so even if there were some other locations which try to normalize stuff, I think that unlike rustc, which has to be sound, rustdoc is free to allow for "unsound" stuff</p>



<a name="218127400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127400">(Nov 27 2020 at 20:34)</a>:</h4>
<p>well typeck</p>



<a name="218127408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127408">(Nov 27 2020 at 20:34)</a>:</h4>
<p>which is disabled for rustdoc</p>



<a name="218127455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127455">(Nov 27 2020 at 20:35)</a>:</h4>
<p>I just think the 'right' way to do this is for rustc to return an error :/</p>



<a name="218127508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127508">(Nov 27 2020 at 20:36)</a>:</h4>
<p>otherwise any other tool will have to encounter this bug, then find and implement its own hack simply because it's not special cased</p>



<a name="218127658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218127658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218127658">(Nov 27 2020 at 20:39)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218127455">said</a>:</p>
<blockquote>
<p>I just think the 'right' way to do this is for rustc to return an error :/</p>
</blockquote>
<p>probably <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="218128146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128146">(Nov 27 2020 at 20:47)</a>:</h4>
<p>maybe one thing we could start with is improving the error message</p>



<a name="218128149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128149">(Nov 27 2020 at 20:47)</a>:</h4>
<p>it's not clear at all that the overflow is because there's a cycle</p>



<a name="218128237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128237">(Nov 27 2020 at 20:48)</a>:</h4>
<p>this bit in particular: <a href="https://github.com/rust-lang/rust/blob/774bce7f5e9d0cc99a30cf37be5d175a3b530beb/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs#L216">https://github.com/rust-lang/rust/blob/774bce7f5e9d0cc99a30cf37be5d175a3b530beb/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs#L216</a></p>



<a name="218128427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128427">(Nov 27 2020 at 20:52)</a>:</h4>
<p>I'll start with that, it will at least get me a little more familiar with what's going on</p>



<a name="218128435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128435">(Nov 27 2020 at 20:52)</a>:</h4>
<p>isn't that kind of hard to know?</p>



<a name="218128437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128437">(Nov 27 2020 at 20:52)</a>:</h4>
<p>whether an overflow is a cycle or not</p>



<a name="218128442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128442">(Nov 27 2020 at 20:52)</a>:</h4>
<p>though we could do better for cycles of length 1 <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="218128454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128454">(Nov 27 2020 at 20:53)</a>:</h4>
<p>there's a function just for it, it's the one I linked</p>



<a name="218128461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128461">(Nov 27 2020 at 20:53)</a>:</h4>
<p>it's special cased already not to suggest increasing the type lenght limit</p>



<a name="218128532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128532">(Nov 27 2020 at 20:54)</a>:</h4>
<p>i should really read stuff a bit more thoroughly before writing stuff <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="218128570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128570">(Nov 27 2020 at 20:55)</a>:</h4>
<p>hmm, I wonder if I could make <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.report_cycle">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.report_cycle</a> more general</p>



<a name="218128646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218128646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218128646">(Nov 27 2020 at 20:57)</a>:</h4>
<p>maybe I'm trying to generalize too soon though, I'll just copy paste for now</p>



<a name="218129502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218129502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218129502">(Nov 27 2020 at 21:13)</a>:</h4>
<p>hmm, so a way I can see returning an error is changing this bit in ObligationForest to allow returning something: <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_data_structures/src/obligation_forest/mod.rs#L561-L566">https://github.com/rust-lang/rust/blob/master/compiler/rustc_data_structures/src/obligation_forest/mod.rs#L561-L566</a></p>



<a name="218129569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218129569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218129569">(Nov 27 2020 at 21:14)</a>:</h4>
<p>or maybe just changing some state on <code>processor</code> and aborting later</p>



<a name="218130159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130159">(Nov 27 2020 at 21:23)</a>:</h4>
<p>so my first attempt at this didn't really work: apparently there's only one thing in the cycle?</p>
<div class="codehilite"><pre><span></span><code>error[E0391]: cycle detected when evaluating the requirement `&lt;T as Foo&gt;::Item: Sized`
  --&gt; /home/joshua/rustc/src/test/ui/generic-associated-types/projection-bound-cycle.rs:47:5
   |
47 |     type Assoc = OnlySized&lt;&lt;T as Foo&gt;::Item&gt;;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
</code></pre></div>



<a name="218130214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130214">(Nov 27 2020 at 21:24)</a>:</h4>
<p>even though I printed out everything else: <a href="https://hastebin.com/aqinefuran.rust">https://hastebin.com/aqinefuran.rust</a></p>



<a name="218130344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130344">(Nov 27 2020 at 21:27)</a>:</h4>
<p>what even is a PredicateObligation <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="218130456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130456">(Nov 27 2020 at 21:28)</a>:</h4>
<p><code>Obligation&lt;Predicate&gt;</code></p>



<a name="218130458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130458">(Nov 27 2020 at 21:28)</a>:</h4>
<p><span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="218130483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130483">(Nov 27 2020 at 21:29)</a>:</h4>
<p>obligations are things we have to prove</p>



<a name="218130490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130490">(Nov 27 2020 at 21:29)</a>:</h4>
<p>and predicate obligations mean that we have to prove a predicate</p>



<a name="218130545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130545">(Nov 27 2020 at 21:30)</a>:</h4>
<p>'predicate' is some property of a type?</p>



<a name="218130549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130549">(Nov 27 2020 at 21:30)</a>:</h4>
<p>with predicate being one of the following <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.PredicateAtom.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.PredicateAtom.html</a></p>



<a name="218130586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130586">(Nov 27 2020 at 21:31)</a>:</h4>
<p>so if we want to use <code>v: Vec&lt;i32&gt;</code>, <code>v.into_iter()</code></p>



<a name="218130599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130599">(Nov 27 2020 at 21:31)</a>:</h4>
<p>we would have to prove <code>Vec&lt;i32&gt;: Iterator</code></p>



<a name="218130609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130609">(Nov 27 2020 at 21:31)</a>:</h4>
<p>a <code>PredicateAtom::Trait</code></p>



<a name="218130658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130658">(Nov 27 2020 at 21:32)</a>:</h4>
<p>makes sense</p>



<a name="218130665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130665">(Nov 27 2020 at 21:32)</a>:</h4>
<p>how does the compiler know there's been a cycle?</p>



<a name="218130671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130671">(Nov 27 2020 at 21:32)</a>:</h4>
<p>it calls process_backedge; how does it know it needs to?</p>



<a name="218130775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130775">(Nov 27 2020 at 21:34)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218130665">said</a>:</p>
<blockquote>
<p>how does the compiler know there's been a cycle?</p>
</blockquote>
<p><span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span> it's a pessimistic estimate based on idk what</p>



<a name="218130794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218130794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218130794">(Nov 27 2020 at 21:34)</a>:</h4>
<p>it seems that what <em>should</em> be happening is that something somewhere returns a <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/traits/enum.SelectionError.html#variant.Overflow">SelectionError::Overflow</a></p>



<a name="218131667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218131667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218131667">(Nov 27 2020 at 21:52)</a>:</h4>
<p>so I tried doing that, and got these errors:</p>
<div class="codehilite"><pre><span></span><code>error[E0277]: the size for values of type `str` cannot be known at compilation time
  --&gt; /home/joshua/rustc/src/test/ui/generic-associated-types/projection-bound-cycle.rs:28:5
   |
LL |     type Item where str: Sized = str;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn&#39;t have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`

error[E0276]: impl has stricter requirements than trait
  --&gt; /home/joshua/rustc/src/test/ui/generic-associated-types/projection-bound-cycle.rs:28:5
   |
LL |     type Item: Sized where &lt;Self as Foo&gt;::Item: Sized;
   |     -------------------------------------------------- definition of `Item` from trait
...
LL |     type Item where str: Sized = str;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `str: Sized`
</code></pre></div>



<a name="218131681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218131681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218131681">(Nov 27 2020 at 21:52)</a>:</h4>
<p>for this diff: <a href="https://hastebin.com/rilecipaxe.rust">https://hastebin.com/rilecipaxe.rust</a></p>



<a name="218131691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218131691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218131691">(Nov 27 2020 at 21:52)</a>:</h4>
<p>and I feel like I'm sort of flailing around</p>



<a name="218133323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218133323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218133323">(Nov 27 2020 at 22:22)</a>:</h4>
<p>anyway, for now I'll throw in <code>if !actually_rustdoc</code> and shanghai anyone who objects into helping me implement the long-term fix <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="218133781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218133781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218133781">(Nov 27 2020 at 22:31)</a>:</h4>
<p>great, apparently that breaks things</p>
<div class="codehilite"><pre><span></span><code>thread &#39;rustc&#39; panicked at &#39;index out of bounds: the len is 0 but the index is 0&#39;, /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10
</code></pre></div>



<a name="218133793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218133793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218133793">(Nov 27 2020 at 22:31)</a>:</h4>
<p>backtrace: <a href="https://hastebin.com/uyehokalun.apache">https://hastebin.com/uyehokalun.apache</a></p>



<a name="218133802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218133802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218133802">(Nov 27 2020 at 22:31)</a>:</h4>
<p>I've tried nothing and I'm out of ideas</p>



<a name="218176952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218176952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218176952">(Nov 28 2020 at 19:16)</a>:</h4>
<p>another possibility is to make this off-by-default and opt-in with <code>-Z normalize-all</code> or something like that</p>



<a name="218176958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218176958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218176958">(Nov 28 2020 at 19:17)</a>:</h4>
<p>then the compiler docs are still readable, without running into all the regressions in the ecosystem</p>



<a name="218177929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218177929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218177929">(Nov 28 2020 at 19:37)</a>:</h4>
<p><span class="user-mention" data-user-id="219477">@Markus Westerlind</span> I saw you had a big PR refactoring obligation forest - do you have ideas for how to refactor it to return an error on overflow instead of aborting immediately?</p>



<a name="218177939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218177939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218177939">(Nov 28 2020 at 19:37)</a>:</h4>
<p>context: <a href="https://github.com/rust-lang/rust/issues/79459">https://github.com/rust-lang/rust/issues/79459</a></p>



<a name="218178111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218178111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218178111">(Nov 28 2020 at 19:42)</a>:</h4>
<p>another thing I'm not clear about: why does obligation_forest use traits everywhere? AFAIK <code>OutcomeTrait</code> and <code>ObligationProcessor</code> are only implemented once (outside of tests)</p>



<a name="218178125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218178125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218178125">(Nov 28 2020 at 19:43)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/traits/resolution.html">https://rustc-dev-guide.rust-lang.org/traits/resolution.html</a> seems relevant</p>



<a name="218178933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218178933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218178933">(Nov 28 2020 at 20:06)</a>:</h4>
<p><span class="user-mention" data-user-id="125294">@Aaron Hill</span> so I found a few things playing around today.</p>
<ol>
<li>I think I found a case where switching to Canonical mode would help: <a href="https://github.com/rust-lang/rust/issues/79506#issuecomment-735283913">https://github.com/rust-lang/rust/issues/79506#issuecomment-735283913</a></li>
<li>Yesterday, I only enabled canonical mode for intra-crate trait lookups; between crates it was still in standard mode: <a href="https://github.com/rust-lang/rust/blob/e37f25aa3f356546ab851e394d5598fc575eabda/compiler/rustc_trait_selection/src/traits/select/mod.rs#L232">https://github.com/rust-lang/rust/blob/e37f25aa3f356546ab851e394d5598fc575eabda/compiler/rustc_trait_selection/src/traits/select/mod.rs#L232</a></li>
<li>Switching to canonical mode for inter-crate lookups causes an ICE <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span> </li>
</ol>
<div class="codehilite"><pre><span></span><code>thread &#39;rustc&#39; panicked at &#39;assertion failed: self.query_mode == TraitQueryMode::Standard&#39;, compiler/rustc_trait_selection/src/traits/select/mod.rs:362:9
</code></pre></div>
<p><a href="https://github.com/rust-lang/rust/blob/e37f25aa3f356546ab851e394d5598fc575eabda/compiler/rustc_trait_selection/src/traits/select/mod.rs#L364-L366">https://github.com/rust-lang/rust/blob/e37f25aa3f356546ab851e394d5598fc575eabda/compiler/rustc_trait_selection/src/traits/select/mod.rs#L364-L366</a></p>



<a name="218178998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218178998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218178998">(Nov 28 2020 at 20:08)</a>:</h4>
<p>backtrace for that ICE: <a href="https://hastebin.com/eloviwosag.rust">https://hastebin.com/eloviwosag.rust</a></p>
<div class="codehilite"><pre><span></span><code>query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `convert::From`
#1 [check_mod_impl_wf] checking that impls are well-formed in module `num::error`
end of query stack
</code></pre></div>
<p>note that this is on valid code, while compiling libcore</p>



<a name="218179009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179009">(Nov 28 2020 at 20:09)</a>:</h4>
<p>I don't think having it on unconditionally is correct</p>



<a name="218179018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179018">(Nov 28 2020 at 20:09)</a>:</h4>
<p>You would want it just for the rustdoc case</p>



<a name="218179021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179021">(Nov 28 2020 at 20:09)</a>:</h4>
<p>what are the conditions for turning it on?</p>



<a name="218179022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179022">(Nov 28 2020 at 20:09)</a>:</h4>
<p>which could be tricky</p>



<a name="218179025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179025">(Nov 28 2020 at 20:09)</a>:</h4>
<p>just for normalization?</p>



<a name="218179027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179027">(Nov 28 2020 at 20:09)</a>:</h4>
<p>ah ok</p>



<a name="218179029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179029">(Nov 28 2020 at 20:09)</a>:</h4>
<p>well, let me try special-casing rustdoc again <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="218179091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179091">(Nov 28 2020 at 20:11)</a>:</h4>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs</span>
<span class="gh">index 74b6652981a..68d1af67dac 100644</span>
<span class="gd">--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs</span>
<span class="gi">+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs</span>
<span class="gu">@@ -218,18 +218,14 @@ pub fn new(infcx: &amp;'cx InferCtxt&lt;'cx, 'tcx&gt;) -&gt; SelectionContext&lt;'cx, 'tcx&gt; {</span>
             intercrate: false,
             intercrate_ambiguity_causes: None,
             allow_negative_impls: false,
<span class="gd">-            query_mode: TraitQueryMode::Standard,</span>
<span class="gi">+            query_mode: if infcx.tcx.sess.opts.actually_rustdoc { TraitQueryMode::Canonical } else { TraitQueryMode::Standard },</span>
         }
     }

     pub fn intercrate(infcx: &amp;'cx InferCtxt&lt;'cx, 'tcx&gt;) -&gt; SelectionContext&lt;'cx, 'tcx&gt; {
         SelectionContext {
<span class="gd">-            infcx,</span>
<span class="gd">-            freshener: infcx.freshener(),</span>
             intercrate: true,
<span class="gd">-            intercrate_ambiguity_causes: None,</span>
<span class="gd">-            allow_negative_impls: false,</span>
<span class="gd">-            query_mode: TraitQueryMode::Standard,</span>
<span class="gi">+            ..SelectionContext::new(infcx)</span>
         }
     }
</code></pre></div>



<a name="218179153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179153">(Nov 28 2020 at 20:13)</a>:</h4>
<p>ok, so that does actually fix the cross-crate scenario <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="218179156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179156">(Nov 28 2020 at 20:13)</a>:</h4>
<p>so assuming I can figure out a less hacky way to do that, the only thing left is for cycles</p>



<a name="218179276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179276">(Nov 28 2020 at 20:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218179156">said</a>:</p>
<blockquote>
<p>so assuming I can figure out a less hacky way to do that</p>
</blockquote>
<p>This seems to have worked :)</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/compiler/rustc_traits/src/normalize_projection_ty.rs b/compiler/rustc_traits/src/normalize_projection_ty.rs</span>
<span class="gh">index a8e376838e2..0110cf2775a 100644</span>
<span class="gd">--- a/compiler/rustc_traits/src/normalize_projection_ty.rs</span>
<span class="gi">+++ b/compiler/rustc_traits/src/normalize_projection_ty.rs</span>
<span class="gu">@@ -24,7 +24,7 @@ fn normalize_projection_ty&lt;'tcx&gt;(</span>
     tcx.infer_ctxt().enter_canonical_trait_query(
         &amp;goal,
         |infcx, fulfill_cx, ParamEnvAnd { param_env, value: goal }| {
<span class="gd">-            let selcx = &amp;mut SelectionContext::new(infcx);</span>
<span class="gi">+            let selcx = &amp;mut SelectionContext::with_query_mode(infcx, traits::TraitQueryMode::Canonical);</span>
             let cause = ObligationCause::dummy();
             let mut obligations = vec![];
             let answer = traits::normalize_projection_type(
</code></pre></div>



<a name="218179402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179402">(Nov 28 2020 at 20:21)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/79517">https://github.com/rust-lang/rust/pull/79517</a></p>



<a name="218179576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179576">(Nov 28 2020 at 20:26)</a>:</h4>
<p><span class="user-mention" data-user-id="125294">@Aaron Hill</span> let me know if you think of a way to report this for cycles :) I tried to take a crack at it yesterday without much success</p>



<a name="218179654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179654">(Nov 28 2020 at 20:29)</a>:</h4>
<p>Can you explain again the different between <code>TraitQueryMode::Canonical</code> and a canonical query?</p>



<a name="218179697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179697">(Nov 28 2020 at 20:30)</a>:</h4>
<p>one is the query system (<code>rustc_middle::ty::query</code>) and one is for resolving traits (<code>rustc_trait_selection</code>)?</p>



<a name="218179702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179702">(Nov 28 2020 at 20:30)</a>:</h4>
<p>what is the query system one doing?</p>



<a name="218179851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179851">(Nov 28 2020 at 20:34)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/traits/canonical-queries.html?highlight=canonical#canonical-queries">https://rustc-dev-guide.rust-lang.org/traits/canonical-queries.html?highlight=canonical#canonical-queries</a> tells me what a canonical query is, but not how it differs from a normal query</p>



<a name="218179852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218179852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218179852">(Nov 28 2020 at 20:34)</a>:</h4>
<p>(I think)</p>



<a name="218211528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218211528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218211528">(Nov 29 2020 at 12:51)</a>:</h4>
<p>Went with <a href="https://github.com/rust-lang/rust/pull/79525">https://github.com/rust-lang/rust/pull/79525</a> for now</p>



<a name="218213851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20normalize%20projection%20types%20to%20a%20single%20type%3F/near/218213851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Olivier FAURE <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F.html#218213851">(Nov 29 2020 at 13:54)</a>:</h4>
<p>(deleted)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>